

*****************************************************************************************************
* Table A.8: Effects on food security
* This table reports estimated treatment effects on measures of food security in March
*****************************************************************************************************


use "${SurveyDataDir}/JH_ePOS_HH_DataforAnalysis.dta",clear


keep if ss_code == "SS01" 
drop if ghost_final==1


svyset [pw = pweight]


count if ghost_final == 1
scalar ghosts = r(N)
scalar obs = 3960   

*Get relative weights of AAY and PH rationcard holders by whether RC is in an urban area
sum pweight if rationcardtype == "AAY" & isurban == 0
scalar AAY_weight0 = r(sum)

sum pweight if rationcardtype == "PH" & isurban == 0
scalar PH_weight0 = r(sum)

sum pweight if rationcardtype == "AAY" & isurban == 1
scalar AAY_weight1 = r(sum)

sum pweight if rationcardtype == "PH" & isurban == 1
scalar PH_weight1 = r(sum)



*Analysis
qui svy: mean HHDS if treatment == 0
qui estat sd
matrix Mean0 = r(mean)
matrix SD0 = r(sd)
eststo HHDS: xi: reg HHDS treatment i.strata [pw = pweight], cluster(block_code)
estadd scalar control_mean = `=Mean0[1,1]'
estadd scalar control_sd = `=SD0[1,1]'
estadd scalar percent_obs 100*e(N)/obs

qui svy: mean FCS if treatment == 0
qui estat sd
matrix Mean0 = r(mean)
matrix SD0 = r(sd)

eststo FCS: xi: reg FCS treatment i.strata [pw = pweight], cluster(block_code)
estadd scalar control_mean = `=Mean0[1,1]'
estadd scalar control_sd = `=SD0[1,1]'
estadd scalar percent_obs 100*e(N)/obs



* Output table
#delimit ;
esttab HHDS FCS using "${OutputDir}/TableA_8.tex" , 
	label b(%12.2g) se(%12.2g) booktabs replace nocons nolz  width(\hsize)
	drop(_cons _Istrata*)
	order (treatment)
	coeflabels( treatment "Treatment")
	stats(r2_a control_mean N percent_obs, 
			labels("Adjusted R\textsuperscript{2}" "Control mean" "Observations" "\% of sample"
				) fmt(2 %12.2g %12.2gc 0))
	star(* .10 ** .05 *** .01) 
	mgroups("Dietary diversity score" "Food consumption score",	
			pattern(1 1) prefix(\multicolumn{@span}{c}{) suffix(}) 
			span erepeat(\cmidrule(lr){@span}))
	mlabel(none)
	substitute("Standard errors in parentheses" " "
				"\sym{*} \(p<.10\), \sym{**} \(p<.05\), \sym{***} \(p<.01\)" " "
				"\multicolumn{3}{l}{\footnotesize  }\\" "");
#delimit cr 
eststo clear


